package cn.liye.pingfen.Util;

public class Test {

    public static void main(String[] args) {
        String str = "你真是个畜生，你真的太牛逼了，真是个垃圾,共产党是个好党,我志愿加入中国共产党,你是个啥啊,臭傻逼操你妈的是吧鸡巴";
        String words[] = {"畜生", "牛逼", "垃圾","共产党","操你妈","操","鸡巴","傻逼"};
        for (int i = 0; i < words.length; i++) {
            if (str.matches(".*" + words[i] + ".*")) {
//				计算需要的*的个数
                String s = "";
                for (int j = 0; j < words[i].length(); j++) {
                    s += "*";
                }
                str = str.replaceAll(words[i], s);
            }
        }
        System.out.println(str);
    }




}

